import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)
    //路由就是页面，会改变浏览器导航栏信息

//路由配置信息
const routes = [{
        path: '/', //路由的路径,无需首字母大写
        name: 'Home', //给当前展示页面起的名字，不能重名，首字母大写
        component: Home //路由所对应的页面，是一个vue模板文件
    },
    {
        path: '/about',
        name: 'About',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => //也可以是函数的形式，一般用第二种（函数）
            import ( /* webpackChunkName: "about" */ '../views/About.vue')
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router